home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Languages
/
PC Basic
/
PCBASIC Stand alone version
/
PCBASIC Runtime
/
PCBASICConst.asm
next >
Wrap
Assembly Source File
|
1986-06-09
|
11KB
|
384 lines
;
; BASICmacconst 4/15/86
;
; PCBASIC run-time variable definitions
;
; Macintosh Native Object code version
;
; by Pterodactyl Software, Copyright, 1985
;
; Environment
;
texp 0
mexp 0
locsym '@'
noloc
;
;
; Variable Definitions by Offset
;
;
str$top equ -4 ; strtop: longint; { Pointer to end of strings}
str$ptr equ str$top-4 ; strptr: longint; { Pointer to string-area segment}
heap$len equ str$ptr-4 ; heaplen: longint; { Length of file-area segment}
heap$ptr equ str$ptr-8 ; heaptr: longint; { Pointer to file-area segment}
scrn$ptr equ heap$ptr-4 ; scrnptr: longint; { Pointer to screen-area segment}
trap$ptr equ scrn$ptr-4 ; trapptr : ptr; { Pointer to trap-area segment}
trap$len equ trap$ptr-2 ; traplen : integer; { Length of trap-area segment}
bor$hand equ trap$len-4 ; border: RgnHandle; { Border region}
line$num equ bor$hand-2 ; line_no: integer; { BASIC Line Number}
err$num equ line$num-2 ; err_no: integer; { Error number }
c$ommand equ err$num-2 ; command: integer; { Pascal routine to execute }
file$buf equ c$ommand-258 ; pad : integer; { I/O may overshoot buffer }
; file_str: string [255]; {record for I/O}
file$len equ file$buf ; first byte of string is length
file$str equ file$buf+1 ; then data follows
file$num equ file$buf-4 ; file_num: longint; {reference number for file I/O}
file$ptr equ file$num-4 ; file_ptr: longint; {pointer to file I/O buffer}
; conversion parameter
int$x equ file$ptr-2 ; intx : integer; { Integer input}
int$y equ int$x-2 ; inty : integer; { Integer input}
fp$x equ int$y-4 ; fpx : real; { Floating input}
fp$y equ fp$x-4 ; fpy : real; { Floating output}
str$x equ fp$y-256 ; strx : string[255] { String input}
str$y equ str$x-30 ; stry : string[29] { String output}
; device parameters
pos$1 equ str$y-2 ; pos1 : integer; { Printer 1 column, 1..132}
wid$1 equ pos$1-2 ; wid1 : integer; { Printer 1 width, 1 .. 255}
pos$2 equ wid$1-2 ; pos2 : integer; { Printer 2 column, 1..132}
wid$2 equ pos$2-2 ; wid2 : integer; { Printer 2 width, 1 .. 255}
pos$3 equ wid$2-2 ; pos3 : integer; { Printer 3 column, 1..132}
wid$3 equ pos$3-2 ; wid3 : integer; { Printer 3 width, 1 .. 255}
; screen parameters
pos$0 equ wid$3-2 ; pos0 : integer; { Cursor column, 1..80}
wid$0 equ pos$0-2 ; wid0 : integer; { Screen width, 40 or 80}
csr$lin equ wid$0-2 ; csrlin: integer; { Cursor line, 1..25}
lp$x equ csr$lin-2 ; lpx : integer; { x coörd of last point refereneced }
lp$y equ csr$lin-4 ; lpy : integer; { y coörd of last point refereneced }
ap$x equ csr$lin-6 ; apx : integer; { x coörd of point A }
ap$y equ csr$lin-8 ; apy : integer; { y coörd of point A }
bp$x equ csr$lin-10 ; bpx : integer; { x coörd of point B }
bp$y equ csr$lin-12 ; bpy : integer; { y coörd of point B }
a$spect equ csr$lin-16 ; aspect: real; { Circle aspect ratio}
def$asp equ a$spect-4 ; DefAspect :real; {Default value for aspect}
csr$ptrn equ def$asp-68 ; csrpat: cursor; { Cursor data,
csr$mask equ csr$ptrn+32 ; mask,
csr$spot equ csr$mask+32 ; and hot spot}
edit$rec equ csr$ptrn-28 ; EditRect: rect { Window data area}
cfig$upd equ csr$ptrn-30 ; CfigUpdate: integer{ Update & buffer options}
vis$pg equ csr$ptrn-31 ; byte visual (top) page LSB
act$page equ csr$ptrn-32 ; byte active (output) page MSB
;
;
asm$var equ act$page-1200 ; asmvar: array [1..300] of longint
;
;
; screen ASM values
max$pg equ asm$var+18 ; byte maximum page num in use for seg size
for$col equ asm$var+19 ; byte foreground color or pen pattern
back$col equ asm$var+20 ; byte background color
bor$col equ asm$var+21 ; byte border color or text face
scrn$mode equ asm$var+22 ; word screen mode. >2 -> font(n)
csr$vue equ asm$var+24 ; word 0=hide cursor, 1=show, else init
csr$flg equ asm$var+26 ; byte $40 -> Show carret. $80 -> On screen
csr$top equ asm$var+28 ; word first cursor line
csr$bot equ asm$var+30 ; word last cursor scan line
csr$pnt equ asm$var+32 ; long pointer into active page
text$mod equ asm$var+36 ; byte mode for drawing text
text$fac equ asm$var+37 ; byte text face
font$asc equ asm$var+38 ; word text font Ascent
font$des equ asm$var+40 ; word text font Descent
; zooming values
view$lft equ asm$var+44 ; word clip region & viewport left
view$top equ asm$var+46 ; word clip region & viewport top
view$rt equ asm$var+48 ; word clip region & viewport right
view$bot equ asm$var+50 ; word clip region & viewport bottom
wind$lft equ asm$var+52 ; long window left
wind$top equ asm$var+56 ; long window top
wind$rt equ asm$var+60 ; long window right
wind$bot equ asm$var+64 ; long window bottom
vuoff$x equ asm$var+68 ; word viewport x offset
vuoff$y equ asm$var+70 ; word viewport y offset
wdoff$x equ asm$var+72 ; long window x offset
wdoff$y equ asm$var+76 ; long window y offset
wdmul$x equ asm$var+80 ; long window x multiplier or 0 if no window
wdmul$y equ asm$var+84 ; long window y multiplier or 0 if no window
;
err$adr equ asm$var+92 ; long address for error retry
file$mode equ asm$var+100 ; word file I/O mode command for open
rec$num equ file$mode+2 ; long record nuimber for get or put
fil$hands equ file$mode+6 ; long file handles available
line$adr equ file$mode+10 ; long line start+4 in case of error
retry$stk equ line$adr+4 ; long restore to A7 on error retry
stack$bot equ line$adr+8 ; long restore to A7 for new program
err$line equ line$adr+12 ; long line start for error retry
err$vect equ err$line+4 ; long error handler address
data$ptr equ err$vect+8 ; long pointer to next DATA statement
inp$retry equ err$vect+12 ; long prompt display for input retry
inp$stack equ err$vect+16 ; long stack point for input retry
seq$flg equ err$vect+21 ; byte Seq disk file compatibility
trac$lin equ err$vect+22 ; word Last line number displayed
opt$base equ err$vect+28 ; word min array number, option base
dflt$flg equ opt$base+2 ; byte $FF -> default device
prec$flg equ opt$base+3 ; byte precision of operation
field$pnt equ opt$base+4 ; long pntr into file buf during FIELD
width$255 equ opt$base+8 ; long default width and position
;
; Keyboard and Mouse
;
keyin$idx equ opt$base+18 ; byte pointer into key input string
key$in equ opt$base+20 ; long string for function key input
; mouse(0) .. mouse(6) ; 14 bytes mouse function values
mouse$y equ opt$base+28 ; word MOUSE(2)
mouse$x equ opt$base+30 ; word MOUSE(1)
Atr$byte equ mouse$y+21 ; byte current Screen atribute
Atr$Off equ mouse$y+22 ; word size of text buffer
Cur$Evt equ mouse$y+24 ; Event record
Cur$What equ Cur$Evt ; word Type of Event
Cur$Msg equ Cur$Evt+2 ; long Info about event
Cur$time equ Cur$Evt+6 ; long Tick when event occured
Cur$msy equ Cur$Evt+10 ; word Event mouse y
Cur$msx equ Cur$Evt+12 ; word Event mouse x
Cur$Mod equ Cur$Evt+14 ; word Event case keys
;
; Register Storage
;
pas$reg equ Cur$Evt+72 ; 36 bytes Pascal registers while in ASM
asm$reg equ pas$reg+52 ; 40 bytes ASM registers while in Pascal
; A0 has return address
; LFN pointer table
;
lfn$ptr equ asm$reg+44 ; 520 bytes LFN Pointers to file buffers
;
; Vector into generated code
;
code$start equ lfn$ptr+772 ; long Start of current program
;
; entries to BASIC run-time code
Xref Menu$Num
Xref Wind$Num
Xref l$$ea
Xref dia$log
Xref err$or
Xref p$ause
Xref r$esume
Xref r$eturn
Xref new$lin
Xref new$pro
Xref ret$pro
Xref int$chk
Xref trap$enab
Xref key$on
Xref key$off
Xref key$list
Xref key$set
Xref heap$chk
Xref pack$str
Xref pack$ra
Xref pack$sra
Xref code$bot
Xref e$nd
Xref dim$pro
Xref dim$fin
Xref dim$chk
Xref dim$val
Xref add$str
Xref r$4sng
Xref r$4int
Xref data$in
Xref data$par
Xref r$estore ; 2/3/85
Xref dyn$mode
Xref c$lear
Xref set$file
Xref open$file
Xref c$lose
Xref cl$all
Xref inp$beg
Xref inp$int
Xref inp$sng
Xref inp$dbl
Xref inp$str
Xref inp$lin
Xref init$prus
Xref pr$comma
Xref pr$cr
Xref pr$qm
Xref pr$sng
Xref pr$dbl
Xref pr$int
Xref pr$str
Xref pr$tab
Xref pr$htab
Xref pr$spac
Xref pr$btl
Xref prus$int
Xref prus$str
Xref prus$sng
Xref prus$dbl
Xref prus$end
Xref wr$cr
Xref wr$int
Xref wr$str
Xref wr$sng
Xref wr$dbl
Xref l$oc
Xref l$of
Xref e$of
Xref l$pos
Xref wid$num
Xref wid$str
Xref e$ject
Xref get$rec
Xref put$rec
Xref next$rec
Xref k$ill
Xref f$iles
Xref ch$dir
Xref re$name
Xref c$hain
Xref d$raw
Xref c$ircle
Xref l$ine
Xref b$ox
Xref box$fill
Xref clr$scrn
Xref clr$view
Xref view$scrn
Xref view$set
Xref clr$wind
Xref wind$scrn
Xref wind$set
Xref get$graph
Xref put$graph
Xref c$olor
Xref l$ocate
Xref csr$pat
Xref scrn$pro
Xref scrn$num
Xref poin$num
Xref poin$cor
Xref plot$pro
Xref p$map
Xref p$lay
Xref s$ound
Xref m$ouse
Xref t$imer
Xref time$pro
Xref time$str
Xref date$pro
Xref date$str
Xref pen$num
Xref str$dbl
Xref sng$dbl
Xref val$num
Xref str$int
Xref int$dlr
Xref sng$dlr
Xref dbl$dlr
Xref sng$fix
Xref sng$int
Xref dbl$fix
Xref dbl$int
Xref re$long
Xref re$cint
Xref dbl$cint
Xref dbl$sng
Xref cv$i
Xref cv$s
Xref cv$d
Xref mk$i
Xref mk$s
Xref mk$d
Xref oct$str
Xref hex$str
Xref in$key
Xref in$str
Xref in$putstr
Xref copy$heap
Xref lit$str
Xref l$set
Xref r$set
Xref mid$pro
Xref stri$str
Xref cmp$str
Xref r$andom
Xref sng$ipwr
Xref dbl$ipwr
Xref exp$sng
Xref cmp$sing
Xref dbl$sqrt
Xref dbl$cos
Xref dbl$sin
Xref dbl$exp
Xref tan$dbl
Xref exp$dbl
Xref dbl$atan
Xref dbl$ln
Xref add$dbl
Xref div$dbl
Xref mul$dbl
Xref cmp$dbl
Xref sub$dbl
; iosfplib links
Xref add$sing ; sing add
Xref sub$sing ; sing subtract
Xref mul$sing ; sing multiply
Xref div$sing ; sing divide
Xref sng$sin ; sing sine
Xref sng$cos ; sing cosine
Xref tan$sng ; sing tangent
Xref sng$flt ; longint to sing
Xref sng$exp ; sing e ** x
Xref sng$ln ; sing nat log
Xref sng$sqrt ; sing square root
Xref sng$atan ; sing arctangent
;
; Code Generation Condensing Macros
;
n$p macro &1
jsr new$pro
DC.w &1-seg$tab
endm
;
r$p macro &1,&2
jsr ret$pro
DC.w &1-seg$tab
DC.w $&2
endm
;
n$l macro &1,&2,&3
;
&1 jsr new$lin
DC.w &2-seg$tab
DC.w seg$code
DC.w $&3
endm
;
l$ea macro &1,&2
lea &1,A0
jsr l$$ea
move.l D0,&2
endm
;
go$sub macro &1
; @93 move.l #seg$code*65536+10+@93-seg$tab,-(A7)
DC.W $2F3C,seg$code
DC.W *-seg$tab+6
jmp &1
endm
;
r$ead macro
; @93 move.l #seg$code*65536+14+@93-seg$tab,-(A7)
DC.W $2F3C,seg$code
DC.W *-seg$tab+10
move.l Data$Ptr(A5),-(A7)
jmp r$eturn
endm
;
;
;